/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package futbol5;

import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.GroupLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JWindow;

/**
 *
 * @author Ivan
 */
public class GrillaDiaria extends JFrame {

    public GrillaDiaria() {
        super("Administrar Reservas");
        setSize(600, 600);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        JPanel panel = new JPanel();

        DataHandler dh = null;
        List reservas = null;

        
        try {
            dh = new DataHandler("07022011.xml", false);
            reservas = dh.getReservas();
        } catch (IOException ex) {
            Logger.getLogger(GrillaDiaria.class.getName()).log(Level.SEVERE, null, ex);
        }



        PanelCanchas cancha1 = new PanelCanchas("Cancha1",reservas );
        PanelCanchas cancha2 = new PanelCanchas("Cancha2", reservas);
        PanelCanchas cancha3 = new PanelCanchas("Cancha3", reservas);

        GroupLayout layout = new GroupLayout(panel);
        panel.setLayout(layout);

        layout.setAutoCreateGaps(true);
        layout.setAutoCreateContainerGaps(true);

        GroupLayout.ParallelGroup hGroup = layout.createParallelGroup();

        hGroup.addComponent(cancha1);
        hGroup.addComponent(cancha2);
        hGroup.addComponent(cancha3);
        layout.setHorizontalGroup(hGroup);


        GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();

        vGroup.addComponent(cancha1);
        vGroup.addComponent(cancha2);
        vGroup.addComponent(cancha3);
        layout.setVerticalGroup(vGroup);

        JScrollPane scroll = new JScrollPane();
        scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);

        scroll.setViewportView(panel);
        scroll.getVerticalScrollBar().setUnitIncrement(16);

        add(scroll);




    }
}
